﻿// -----------------------------------------------------------------------
// <copyright file="FormRibbonController.cs" company="">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace AFS.Visitation.Addin
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Office.Interop.Outlook;
    using AFS.Visitation.Addin.Entities;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class FormRibbonController
    {
        RequestDetailsFormRegion requestDetailsForm;
        Ribbon uploadToSharePointRibbon;

        // public event Microsoft.Office.Tools.Outlook.FormRegionInitializingEventHandler FormRegionInitializing;

        public FormRibbonController(RequestDetailsFormRegion requestDetails)
        {
            requestDetailsForm = requestDetails;
        }

        private void ToggleVisibility()
        {
        //    ThisRibbonCollection ribbonCollection = Globals.Ribbons[Globals.ThisAddIn.Application.ActiveInspector()];

        //    if (requestDetailsForm.OutlookItem is Microsoft.Office.Interop.Outlook.AppointmentItem)
        //    {
        //        Microsoft.Office.Interop.Outlook.AppointmentItem appointmentItem = (Microsoft.Office.Interop.Outlook.AppointmentItem)requestDetailsForm.OutlookItem;
        //        InitializeFormRegionFields(appointmentItem);

        //        {
        //            Person currrentUser;
        //            AddressEntry organizer = appointmentItem.GetOrganizer();

        //            if (organizer != null &&
        //organizer.Name == appointmentItem.Session.CurrentUser.Name)
        //            {
        //                currrentUser = new MeetingOrganizer(appointmentItem.Session.CurrentUser);
        //            }
        //            else
        //            {
        //                currrentUser = new MeetingRecipient(appointmentItem.Session.CurrentUser);
        //            }

        //            if (String.IsNullOrEmpty(txtFileName_Hidden.Text)) // Checking if hidden form field is populated, which indicates if InfoPath form data has already been submitted.
        //            {

        //                // If not organizer and non-AFS put fields in read-only and disable button.                 
        //                if (!(currrentUser is MeetingOrganizer) && currrentUser.AccountType != UserType.AFS)
        //                {
        //                    DisableFormControls();
        //                    ribbonCollection.Ribbon.btnUploadToSharepoint.Enabled = false;
        //                }
        //            }
        //            else // Form has been submitted already. Lock-down form fields and button.
        //            {
        //                DisableFormControls();
        //                ribbonCollection.Ribbon.btnUploadToSharepoint.Enabled = false;
        //            }
        //        }
        //    }
        }


    }
}
